import { createRouter, createWebHashHistory } from 'vue-router'

import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history:  createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
      meta: {
        title: '主页',
        state: 'home'
      }
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/AboutView.vue'),
      meta: {
        title: '关于'
      }
    },
    {
      path: '/my',
      name: 'my',
      component: () => import('../views/MineView.vue'),
      meta: {
        title: '个人中心',
        state: 'mine'
      }
    },
    {
      path: '/search',
      name: 'search',
      component: () => import('../views/SearchView.vue'),
      meta: {
        title: '搜索',
        state: 'search'
      }
    }
    ,
    {
      path: '/detail',
      name: 'detail',
      component: () => import('../views/ArticleDetail.vue'),
      meta: {
        title: '详情页',
        state: 'detail'
      }
    } ,
    {
      path: '/classify',
      name: 'classify',
      component: () => import('../views/ClassifyView.vue'),
      meta: {
        title: '分类页',
        state: 'classify'
      }
    }
    ,
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue'),
      meta: {
        title: '登录页',
        state: 'login'
      }
    }
    ,
    {
      path: '/register',
      name: 'register',
      component: () => import('../views/RegisterView.vue'),
      meta: {
        title: '注册页',
        state: 'register'
      }
    }
    ,
    {
      path: '/manage',
      name: 'manage',
      component: () => import('../views/ManageView.vue'),
      meta: {
        title: '账号管理',
        state: 'manage'
      }
    } ,
    {
      path: '/collect',
      name: 'collect',
      component: () => import('../views/CollectView.vue'),
      meta: {
        title: '我的收藏',
        state: 'collect'
      }
    },
    {
      path: '/sigin',
      name: 'sigin',
      component: () => import('../views/SiginView.vue'),
      meta: {
        title: '我的签到',
        state: 'sigin'
      }
    }
  ]
})

export default router
